<template>
	<div style="width:100%">
		<div  class="table-admin-container" style="margin-top: 2px; display: flex; padding: 10px; margin-bottom: 80px;" >
			<el-row :gutter="10" style="width: 100%;">
				<el-col :span="4">
					<el-card style="height: 100%;">
						<template #header>
							<div class="card-header">
								<div class="icon"><el-image src="/src/assets/chain.png" /></div>
								<div class="title">医药制造</div>
							</div>
						</template>
						<List></List>
					</el-card>
				</el-col>
                <el-col :span="20" style="height: 100%;">
                        <TableSearch :search="state.tableData.search" @search="onSearch" />
                        <el-row :gutter="10" style="margin-top: 10px;">
                            <el-col :span="12">
                                <el-card style="height: 100%;" body-style="padding:0">
                                    <template #header>
                                        <div class="card-header">
                                            <div class="icon"><el-image src="/src/assets/chain.png" /></div>
                                            <div class="title">全量企业</div>
                                            <div style="float: right;"> 
                                                <el-input
                                                    v-model="input1"
                                                    style="width: 240px; "
                                                    placeholder="请输入关键信息"
                                                    :suffix-icon="Search"
                                                    />
                                            </div>
                                        </div>
                                    </template>
                                    <Table
                                        ref="tableRef"
                                        v-bind="state.tableData"
                                        class="table-admin"
                                        @updateRow="onTableUpdateRow"
                                        style="height: 100%;"
                                        @add="onTableAddRow"
                                        @delRow="onTableDelRow"
                                        @batchDel="onTableBatchDel"
                                        @pageChange="onTablePageChange"
                                        @sortHeader="onSortHeader"
                                    />
                                </el-card>
                            </el-col>
                            <el-col :span="12">
                                <el-card style="height: 100%;" body-style="padding:0">
                                    <template #header>
                                        <div class="card-header">
                                            <div class="icon"><el-image src="/src/assets/chain.png" /></div>
                                            <div class="title">已背调企业</div>
                                            <div style="float: right;"> 
                                                <el-input
                                                    v-model="input1"
                                                    style="width: 240px; "
                                                    placeholder="请输入关键信息"
                                                    :suffix-icon="Search"
                                                    />
                                            </div>
                                        </div>
                                    </template>
                                    <Table
                                        ref="tableRef"
                                        v-bind="state.tableData"
                                        class="table-admin"
                                        @updateRow="onTableUpdateRow"
                                        style="height: 100%;"
                                        @add="onTableAddRow"
                                        @delRow="onTableDelRow"
                                        @batchDel="onTableBatchDel"
                                        @pageChange="onTablePageChange"
                                        @sortHeader="onSortHeader"
                                    />
                                </el-card>
                            </el-col>
                        </el-row>
                        
                        <EditDialog  ref="editRef"  @refresh="getTableData()" />
                </el-col>
            </el-row>
		</div>
		<!-- <div  class="table-admin-container  layout-padding"  style="width: 400px; float: left; height: 96%;  top: 50px; ">-->
			
		
	</div>
</template>

<script setup lang="ts" name="cgjudgeLists">
import { defineAsyncComponent, reactive, ref, onMounted } from 'vue';
import { ElMessage } from 'element-plus';
import { getList,getListAll,del,batDel,change } from '/@/api/cgjudge/index';
import * as echarts from 'echarts';
import axios from 'axios';
import { handleTree } from '/@/utils';
import chinaMap from "../../assets/100000_full.json";
import {  Search } from '@element-plus/icons-vue'

// 引入组件
const List = defineAsyncComponent(() => import('/@/views/cogen/cgjudge/List.vue'));
const Menu = defineAsyncComponent(() => import('/@/views/cogen/cgjudge/Menu.vue'));
const Table = defineAsyncComponent(() => import('/@/components/table/index.vue'));
const TableSearch = defineAsyncComponent(() => import('/@/components/table/search.vue'));
const EditDialog = defineAsyncComponent(() => import('/@/views/cogen/cgjudge/form/edit.vue'));
// 定义变量内容
const tableRef = ref<RefType>();
const registerRef = ref();
const value = ref(4)
const listRef = ref();
const editRef = ref();
const quRef = ref();
const mapRef = ref();
const state = reactive<TableDemoState>({
	tableData: {
		// 列表数据（必传）
		data: [
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
            {'name':'倪阳平','court':'珠海诺贝尔国际生物医药研究院','duties':'90分','phone':'教授','dutyTime':'博士','mobile':'400-962-5108'},
        ],
		// 表头内容（必传，注意格式）
		header: [
            { key: 'court', colWidth: '300', title: '企业名称', type: 'text', isCheck: true },
            { key: 'duties', colWidth: '220', title: '评分', type: 'text', isCheck: true },
        ],
		// 配置项（必传）
		config: {
			total: 50, // 列表总数
			loading: false, // loading 加载
			isButton: true,
			isBorder: false, // 是否显示表格边框
			isSerialNo: false, // 是否显示表格序号
			isSelection: true, // 是否显示表格多选
			isOperate: true, // 是否显示表格操作栏
            isGetReport:'admin:report:company',
            isReport:'admin:report:company',
		},
		// 搜索表单，动态生成（传空数组时，将不显示搜索，注意格式）
		search: [
        { label: '名称', prop: 'name', placeholder: '请输入企业名称', required: false, type: 'input' },
        { label: '类型', prop: 'court', placeholder: '请输入类型', required: false, type: 'input' },
    ],
		// 搜索参数（不用传，用于分页、搜索时传给后台的值，`getTableData` 中使用）
		param:  {
            page: 1,
            psize: 10,
        },
		//显示分页
		showpage:1,
		// 打印标题
		printName: '数据打印',
		//列字典
		dictData:{
        },
	},
	
});

// // 初始化列表数据
// const getTableData =  () => {
// 	state.tableData.config.loading = true;
// 	state.tableData.data = [];
// 	getList(state.tableData.param).then((response: any) => {
// 		state.tableData.data = response.data.data;
// 		state.tableData.config.total = response.data.total;
// 		state.tableData.config.loading = false;
// 	});
// };

// 搜索点击时表单回调
const onSearch = (data: EmptyObjectType) => {
	state.tableData.param = Object.assign({}, state.tableData.param, { ...data });
	tableRef.value.pageReset();
};
// 删除当前项回调
const onTableDelRow = (row: EmptyObjectType) => {
	return del(row.id).then(() => {
		getTableData();
		ElMessage.success(`删除法官${row.name}成功！`);
	});
};
const onTableBatchDel = (ids: string) => {
	return batDel(ids).then(() => {
		getTableData();
		ElMessage.success(`批量删除成功！`);
	});
	console.log(ids)
};
// 分页改变时回调
const onTablePageChange = (page: TableDemoPageType) => {
	state.tableData.param.page = page.page;
	state.tableData.param.psize = page.psize;
	getTableData();
};
// 拖动显示列排序回调
const onSortHeader = (data: TableHeaderType[]) => {
	state.tableData.header = data;
};

/** 新增按钮操作 */
const onTableAddRow = () => {
	editRef.value.openDialog('add');
};
/** 修改按钮操作 */
const onTableUpdateRow = (row: any) => {
	editRef.value.openDialog('edit',row);
};


</script>

<style scoped lang="scss">
.menu {
	width: 100%;
	height: 50px;
	background-color: #ffffff;
	li {
		list-style: none;
		float: left;
		width: 6.1%;
		font-size: 16px;
		line-height: 50px;
		text-align: center;
	}
}
.table-admin-container {
	.table-admin-padding {
		padding: 15px;
		.table-admin {
			flex: 1;
			overflow: hidden;
		}
	}
}
.el-input__wrapper {
    border-radius: 0 !important;
}
</style>
